/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package braipetro.data_access;


/**
 *
 * @author manasses
 */
public class DataParameter {
    
    private String name;
    private Object value;
    private DataFieldType type;
    
    //--------------------------------------------------------------------------
    // CONSTRUCTORS
    //--------------------------------------------------------------------------
 
    public DataParameter() {}
    
    public DataParameter(String name) {
        this.name = name;
    }
    
    public DataParameter(String name, Object value) {
        this.name = name;
        this.value = value;
    }
    
    private DataParameter(String name, Object value, DataFieldType type) {
        this.name = name;
        this.value = value;
        this.type = type;
    }

    //--------------------------------------------------------------------------
    // GETS AND SETS
    //--------------------------------------------------------------------------
    
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Object getValue() {
        Object val = value;
        
        switch (this.type) {
            case dtSTRING:
                val = "'"+((String)val)+"'";
                break;
            case dtINTEGER:
                break;  
            case dtDOUBLE:
                break;
             case dtDATETIME:
                break;
            case dtDATE:
                break;
            case dtTIME:
                break;
        }
        
        return val;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    public DataFieldType getType() {
        return type;
    }

    public void setType(DataFieldType type) {
        this.type = type;
    }
    
    public String getString() {
        String val = "";
        
        switch (this.type) {
            case dtSTRING:
                val = "'"+((String)value)+"'";
                break;
            case dtINTEGER:
                val = (String)value;
                break;  
            case dtDOUBLE:
                val = (String)value;
            case dtDATETIME:
                break;
            case dtDATE:
                break;
            case dtTIME:
                break;
        }
        
        return val;
    }
       
}
